#ifndef __LOGGING_HH__
#define __LOGGING_HH__

#include <boost/logging/format_fwd.hpp>
#include <boost/logging/format/named_write_fwd.hpp>

#include "Common/AutoSingleton.hh"

namespace _bl = boost::logging;
namespace _blsu = boost::logging::scenario::usage;

namespace Common
{

class Logger : public Common::AutoSingleton< Logger >
{
	public:
		typedef _bl::tag::holder <
					_bl::optimize::cache_string_one_str<>,
					_bl::tag::thread_id,
					_bl::tag::time
				> log_string_type;

		typedef _blsu::use <
					_blsu::filter_::change::often<10>,	// how often do you manipulate (change) the filter?
					_blsu::filter_::level::no_levels,	// does the filter use levels?
					_blsu::logger_::change::often<10>,	// how often do you manipulate (change) the logger?
					_blsu::logger_::favor::correctness	// for the logger: do you favor speed or correctness?
				> log_use;
	
	private:
		void _initialize( );

	public:
		static void initialize( ) { Logger::getRef()._initialize(); }; 
};

}

BOOST_LOG_FORMAT_MSG( Common::Logger::log_string_type )
BOOST_DECLARE_LOG_FILTER( g_log_filter, Common::Logger::log_use::filter )
BOOST_DECLARE_LOG( g_l, Common::Logger::log_use::logger )

#define L_ BOOST_LOG_USE_LOG_IF_FILTER( g_l(), g_log_filter()->is_enabled() ) 

#endif
